package com.weu.mapper;

import com.weu.bean.Series;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SeriesMapper {
    /**
     * 查询所有汽车类型
     *
     * @return
     */
    @Select("select * from ilmc_series")
    public List<Series> getAll();

    /**
     * 查询指定ID的汽车类型
     *
     * @param id
     * @return
     */
    @Select("select * from ilmc_series where series_id=#{id}")
    public Series getOne(int id);

    /**
     * 根据品牌ID和类型ID查找系列
     *
     * @param seriesCartypeid
     * @param seriesBrandid
     * @return
     */
    public List<Series> getSeries(@Param("seriesCartypeid") int seriesCartypeid, @Param("seriesBrandid") int seriesBrandid);

    /**
     * 根据汽车类型ID删除指定汽车类型
     *
     * @param id
     * @return
     */
    @Delete("delete from ilmc_series where series_id=#{id}")
    public int delById(int id);

    /**
     * 修改汽车类型
     *
     * @param series
     * @return
     */
    @Update("update ilmc_series set series_cartypeid = #{seriesCartypeid}, series_name = #{seriesName}, series_brandid = #{seriesBrandid}  where series_id = #{seriesId}")
    public int updateSeries(Series series);

    /**
     * 保存汽车类型
     *
     * @param series
     * @return
     */
    @Insert("insert into ilmc_series(series_cartypeid, series_name, series_brandid) values(#{seriesCartypeid}, #{seriesName}, #{seriesBrandid})")
    public int saveSeries(Series series);
}
